package com.rc.object;

import java.io.Serializable;

import com.rc.activity.dao.tbl_Trip;
import com.rc.util.Util;

public class TripObj extends tbl_Trip implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Long TripID;
	private String TripName;
	private String TripTime;
	private long TripMoney;
	private String TripType;
	private long TripMoneyClamer;

	public static String[] keys = { "TripID", "ReportID", "Name", "Departure",
			"Arrival", "StartDate", "EndDate", "TripType", "CreatedTime",
			"Reference", "IsArchived", "Leg", "ReportStatus", "IsClaimed",
			"IsApproved", "IsSubmitted", "IsAllApproved", "Amount",
			"Categories", "Memo", "UserID" };

	public static String TRIP_ID = keys[0];
	public static String REPORT_ID = keys[1];
	public static String NAME = keys[2];
	public static String DEPARTURE = keys[3];
	public static String ARRIVAL = keys[4];
	public static String START_DATE = keys[5];
	public static String END_DATE = keys[6];
	public static String TRIP_TYPE = keys[7];
	public static String CREATED_TIME = keys[8];
	public static String REFERENCE = keys[9];
	public static String IS_ARCHIVED = keys[10];
	public static String LEG = keys[11];
	public static String REPORT_STATUS = keys[12];
	public static String IS_CLAIMED = keys[13];
	public static String IS_APPROVED = keys[14];
	public static String IS_SUBMITTED = keys[15];
	public static String IS_ALL_APPROVED = keys[16];
	public static String AMOUNT = keys[17];
	public static String CATEGORIES = keys[18];
	public static String MEMO = keys[19];
	public static String USER_ID = keys[20];

	public static tbl_Trip getObjTripByBaseObject(BaseObject baseObject) {
		if (baseObject == null) {
			return null;
		}
		String mStartTime = baseObject.getParam(START_DATE);
		String mEndTime = baseObject.getParam(END_DATE);
		String mCreatedTime = baseObject.getParam(CREATED_TIME);
		int mEndInt = 0;
		int mStartInt = 0;
		if (mStartTime != null) {
			mStartTime = Util.formateDateFromstring("yyyy-MM-dd'T'HH:mm",
					"dd-MM-yyyy", mStartTime);
			mStartInt = Util.parseDateForInt(mStartTime);
		}
		if (mEndTime != null) {
			mEndTime = Util.formateDateFromstring("yyyy-MM-dd'T'HH:mm",
					"dd-MM-yyyy", mEndTime);
			mEndInt = Util.parseDateForInt(mEndTime);
		}

		if (mCreatedTime != null) {
			mCreatedTime = Util.formateDateFromstring("yyyy-MM-dd'T'HH:mm",
					"dd-MM-yyyy", mCreatedTime);
		}

		return new tbl_Trip(baseObject.getParamLong(TRIP_ID),
				baseObject.getParamLong(REPORT_ID), baseObject.getParam(NAME),
				baseObject.getParam(DEPARTURE), baseObject.getParam(ARRIVAL),
				mStartTime, mEndTime, baseObject.getParam(TRIP_TYPE),
				mCreatedTime, baseObject.getParam(REPORT_STATUS),
				baseObject.getParam(REFERENCE),
				baseObject.getParamInt(IS_ARCHIVED), baseObject.getParam(LEG),
				"", baseObject.getParamInt(IS_CLAIMED),
				baseObject.getParamInt(IS_APPROVED),
				baseObject.getParamInt(IS_SUBMITTED),
				baseObject.getParamInt(IS_ALL_APPROVED),
				baseObject.getParam(AMOUNT), false,
				baseObject.getParam(CATEGORIES), "", "", "", mEndInt,
				baseObject.getParam(MEMO), mStartInt, mEndInt,
				baseObject.getParam(USER_ID), "");
	}

	public TripObj(Long tripID, String tripName, String tripTime,
			long tripMoney, String tripType, long tripMoneyClamer) {
		super();
		TripID = tripID;
		TripName = tripName;
		TripTime = tripTime;
		TripMoney = tripMoney;
		TripType = tripType;
		TripMoneyClamer = tripMoneyClamer;
	}

	public TripObj() {
		super();
	}

	public Long getTripID() {
		return TripID;
	}

	public void setTripID(Long tripID) {
		TripID = tripID;
	}

	public String getTripName() {
		return TripName;
	}

	public void setTripName(String tripName) {
		TripName = tripName;
	}

	public String getTripTime() {
		return TripTime;
	}

	public void setTripTime(String tripTime) {
		TripTime = tripTime;
	}

	public long getTripMoney() {
		return TripMoney;
	}

	public void setTripMoney(long tripMoney) {
		TripMoney = tripMoney;
	}

	public String getTripType() {
		return TripType;
	}

	public void setTripType(String tripType) {
		TripType = tripType;
	}

	public long getTripMoneyClamer() {
		return TripMoneyClamer;
	}

	public void setTripMoneyClamer(long tripMoneyClamer) {
		TripMoneyClamer = tripMoneyClamer;
	}

}
